#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int partition(int array[], int left, int right)
{
	int tmp = array[left];

	while (left < right)
	{
		while (left < right && array[right] >= tmp)
		{
			right--;
		}
		array[right] = array[left];
		while (left < right && array[left] <= tmp)
		{
			left++;
		}
		array[left] = array[right];
	}
	array[left] = tmp;
}
void quickSort(int array[], int left, int right)
{
	if (left > right)
	{
		return;
	}

	int pivotindex = partition(array, left, right);
	quickSort(array, left, pivotindex - 1);
	quickSort(array, pivotindex + 1, right);
}
char** findRelativeRanks(int* score, int scoreSize, int* returnSize) 
{
	char** answer = (char**)malloc(scoreSize);

	int ret[] = (int)malloc(scoreSize);
	memcpy(ret, score, scoreSize);
	quickSort(ret, 0, scoreSize);

	for (int i = 0; i < scoreSize; i++)
	{
		for (int j = 0; j < scoreSize; j++)
		{
			if (score[i] == ret[j])
			{
				score[i] = j + 1;
			}
		}
	}

	for (int i = 0; i < scoreSize; i++)
	{
		switch (i)
		{
		case 0:
			answer[i] = "Gold Medal";
			break;
		case 1:
			answer[i] = "Silver Medal";
			break;
		case 2:
			answer[i] = "Bronze Medal";
			break;
		default:
			answer[i] = i + 1 + "";
			break;
		}
	}
	return answer;
}
int main()
{
	return 0;
}